#pragma once

#include <QApplication> 
#include <QGridLayout>
#include <QWidget> 
#include <QLabel> 
#include <QImage> 
#include <QTimer>

#include <iostream>
#include <string>

#include <highgui.h>
#include <cv.h>
#include <opencv2/opencv.hpp>

#include "seeta_alignment.h"

using namespace std;

class FaceAlignment : public QWidget
{
    Q_OBJECT

    public:
        FaceAlignment(QWidget *parent = 0);
        /*
        FaceAlignment(const int width = DEFAULT_WINDOW_WIDTH,
                const int height = DEFAULT_WINDOW_HEIGHT,
                QWidget *parent = 0);
                
        FaceAlignment(const int width = DEFAULT_WINDOW_WIDTH,
                const int height = DEFAULT_WINDOW_HEIGHT,
                const string title = DEFAULT_TITLE,
                QWidget *parent = 0);
        */
        void setDoAlign(const bool val);

    public slots:   // You can learn friendly here, if you get time ,try it. Thu 06 Oct 2016 10:25:45 
        void openCamera();
        void closeCamera();
        void startAlignment();
        void stopAlignment();

    private slots:
        void capture();

    private:
        void setupLayouts();

    private:
        CvCapture *camera0;
        IplImage *frame;
        bool doCapture;
        bool doAlign;

        SeetaAlignment *seetaFA;

        QImage *image;
        QTimer *timer;
        QLabel *label0;
        QLabel *label1;
};

